package com.naja.auth2server.common.enums;

import lombok.Getter;

/**
 * 标注分类状态:默认:1有效，2已删除
 */
@Getter
public enum DemoEnum {
    S1(1, "有效"),
    S2(2, "已删除"),
    ;

    private int status;
    private String desc;

    private DemoEnum(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static DemoEnum getEnum(Integer status) {
        if (status != null) {
            DemoEnum[] values = DemoEnum.values();
            for (DemoEnum value : values) {
                if (value.getStatus() == status) {
                    return value;
                }
            }
        }
        return null;
    }
}
